﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Xml;
using System.Xml.Xsl;
using Ext.Net;

public partial class AddClient : System.Web.UI.Page
{   
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    //[DirectMethod]
    //protected void LogCompanyInfo()
    //{
    //    Response.Redirect("http://google.com");
    //}

    [DirectMethod]
    public void addClient()
    {
        label1.Text = "okudu";
        SqlConnection myConnection;
        SqlCommand myCommand;
        //SqlDataReader myDataReader;

        string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["SiyahBayrakConnectionString"].ConnectionString;

        myConnection = new SqlConnection(strConn);
        myConnection.Open();
        myCommand = new SqlCommand("addClient", myConnection);
        myCommand.CommandType = System.Data.CommandType.StoredProcedure;

        DateTime createDate;
        createDate = DateTime.Now;

        myCommand.Parameters.AddWithValue("@name", name.Text);
        myCommand.Parameters.AddWithValue("@surName", surname.Text);
        myCommand.Parameters.AddWithValue("@tcNo", tcno.Text);
        myCommand.Parameters.AddWithValue("@mobilePhone", mphone.Text);
        myCommand.Parameters.AddWithValue("@homePhone", hphone.Text);
        myCommand.Parameters.AddWithValue("@workPhone", wphone.Text);
        myCommand.Parameters.AddWithValue("@homeAddress", haddress.Text);
        myCommand.Parameters.AddWithValue("@workAddress", waddress.Text);
        myCommand.Parameters.AddWithValue("@email", email.Text);
        myCommand.Parameters.AddWithValue("@createDate", createDate);        
        myCommand.ExecuteNonQuery();

        label1.Text = "Your record has been saved.";
        Button1.Visible = false;

    }    
}